package com.itec.learn.springdata.simple;

import org.springframework.data.jpa.domain.AbstractPersistable;

import javax.persistence.*;

/**
 * @author chenyiqun
 */
@Entity
public class Employee extends AbstractPersistable<Long> {

    private String employeeNum;

    /**
     * 创建Employee, 级联创建Person
     */
    @OneToOne(cascade = {CascadeType.PERSIST},fetch = FetchType.LAZY)
    @JoinColumn(name = "person_id")
    private Person person;

    public String getEmployeeNum() {
        return employeeNum;
    }

    public void setEmployeeNum(String employeeNum) {
        this.employeeNum = employeeNum;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }
}
